package com.hzdaba.aiapi.vo;

import lombok.*;

import java.io.Serializable;

/**
 * 统一响应模板
 *
 * @author 刘逸晖
 */
@NoArgsConstructor
@AllArgsConstructor
@Getter
@Setter
@EqualsAndHashCode
@ToString
@Builder
public class AiApiResponse implements Serializable {

    /**
     * 成功与否
     */
    private boolean result = false;

    /**
     * 描述
     */
    private String reason;

    /**
     * 构建成功请求
     *
     * @param reason 提示信息
     * @return 响应实体
     */
    public static AiApiResponse success(String reason) {
        AiApiResponse aiApiResponse = new AiApiResponse();

        aiApiResponse.setResult(true);
        aiApiResponse.setReason(reason);

        return aiApiResponse;
    }

    /**
     * 构建失败响应
     *
     * @param reason 提示信息
     * @return 响应实体
     */
    public static AiApiResponse fail(String reason) {
        AiApiResponse aiApiResponse = new AiApiResponse();

        aiApiResponse.setResult(false);
        aiApiResponse.setReason(reason);

        return aiApiResponse;
    }

}
